﻿// Infrastructure/Services/ExportService.cs
using ClosedXML.Excel;
using FullApp1.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;



public class ExportService : IExportService
{
    public void ExportToExcel(IEnumerable<object> data, string filePath)
    {
        using var workbook = new XLWorkbook();
        var worksheet = workbook.Worksheets.Add("企业数据");

        worksheet.Cell(1, 1).Value = "企业代码";
        worksheet.Cell(1, 2).Value = "企业名称";
        // 添加其他列头...

        var row = 2;
        foreach (var item in data)
        {
            //if (item is LicenseInfo license)
            //{
            //    worksheet.Cell(row, 1).Value = license.EnterpriseCode;
            //    worksheet.Cell(row, 2).Value = license.EnterpriseName;
            //    // 填充其他数据...
            //    row++;
            //}
        }

        workbook.SaveAs(filePath);
    }

    
}